package com.ml.mall.api.supplier;

import com.ml.mall.annotations.OperLog;
import com.ml.mall.api.BaseController;
import com.ml.mall.bean.base.ApiRestResult;
import com.ml.mall.bean.req.BaseBeanReq;
import com.ml.mall.bean.req.order.OrderEditReq;
import com.ml.mall.bean.req.supplier.OrderMQueryPageReq;
import com.ml.mall.consts.PermissionConst;
import com.ml.mall.service.supplier.SysOrderSupplierService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
* <p>
*  前端控制器
* </p>
*
* @author kyyang
* Created 2021-05-24
*/

@Api(tags = "【order】卖家订单")
@RestController
@RequestMapping("/supplier")
@Slf4j
public class SysOrderSupplierController extends BaseController{

     @Autowired
     private SysOrderSupplierService sysOrderSupplierService;



    @RequestMapping(method = RequestMethod.POST, path = "/m_query_page")
    @ApiOperation("分页查询卖家订单")
//    @RequiresPermissions(PermissionConst.SUPPLIER_M_QUERY_PAGE)
    public ApiRestResult sysOrderMQueryPage(@RequestBody OrderMQueryPageReq req) {
        return ApiRestResult.ok(sysOrderSupplierService.sysOrderMQueryPage(req));
    }

    @RequestMapping(method = RequestMethod.POST, path = "/query_one")
    @ApiOperation("查询卖家订单详情")
//    @RequiresPermissions(PermissionConst.SUPPLIER_QUERY_ONE)
    public ApiRestResult sysOrderQueryOne(@RequestBody BaseBeanReq req) {
        log.info("orderChangeArrVOS===={}",sysOrderSupplierService.sysOrderQueryOne(req));
        return ApiRestResult.ok(sysOrderSupplierService.sysOrderQueryOne(req));
    }


    @RequestMapping(method = RequestMethod.POST, path = "/order_supplier/edit")
    @OperLog(operDesc = "修改卖家订单", operModul = "order", operType = "edit")
    @ApiOperation("修改卖家订单")
//    @RequiresPermissions(PermissionConst.SUPPLIER_EDIT)
    public ApiRestResult sysOrderSupplierEdit(@Valid @RequestBody OrderEditReq orderEditReq ) {
        return ApiRestResult.ok(sysOrderSupplierService.sysOrderSupplierEdit(orderEditReq));
    }


}
